Draws the key when the geom needs to be displayed in a legend and then convert them with ggplotly.

p <- ggplot(economics, aes(date, psavert, color = "savings rate"))
p <-  p + geom_line(key_glyph = "timeseries")
plotly::ggplotly(p)
## Warning in geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
p <- ggplot(economics, aes(date, psavert, color = "savings rate"))
p <-  p + geom_line(key_glyph = draw_key_rect)
plotly::ggplotly(p)
## Warning in geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues